<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input type="checkbox">游泳
<button> 获取选中状态</button>

<script>
var btn = document.querySelector("button");
var loves = document.querySelector("input");
btn.onclick = function (){
    console.log(loves.checked);
}
</script>


</body>
</html>